import { api } from '@/utils/request'
import type { DailyCheckin, CreateDailyCheckinRequest } from '@/types/checkin'

// 获取所有打卡记录
export const getDailyCheckins = () => {
  return api.get<DailyCheckin[]>('/checkins')
}

// 获取用户的打卡记录
export const getUserCheckins = (userId: number) => {
  return api.get<DailyCheckin[]>(`/checkins/user/${userId}`)
}

// 创建打卡
export const createDailyCheckin = (data: CreateDailyCheckinRequest) => {
  return api.post<DailyCheckin>('/checkins', data)
}

// 删除打卡
export const deleteDailyCheckin = (id: number) => {
  return api.delete(`/checkins/${id}`)
}
